<template>
    <div class="app-container">

        <el-form ref="docSetFormRef" :model="docSetForm" label-width="180px">
            <el-row>
                <el-col :span="12">
                    <h4 class="formTitle">文档关键信息统计设置：</h4>
                    <el-form-item label="参与统计的需求重要程度" prop="importance">
                        <el-radio-group v-model="docSetForm.importance">
                            <el-radio :label="1">紧急</el-radio>
                            <el-radio :label="2">重要</el-radio>
                            <el-radio :label="3">一般</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="按照章节数量统计" prop="statsByChapter">
                        <el-checkbox :true-label="1" :false-label="0" v-model="docSetForm.statsByChapter"></el-checkbox>
                    </el-form-item>
                    <el-form-item label="仅统计总数" prop="onlyTotal">
                        <el-checkbox :true-label="1" :false-label="0" v-model="docSetForm.onlyTotal"></el-checkbox>
                    </el-form-item>
                    <el-form-item label="字数是否包含标点符号" prop="containPunc">
                        <el-checkbox :true-label="1" :false-label="0" v-model="docSetForm.containPunc"></el-checkbox>
                    </el-form-item>
                    <el-form-item label="段落是否包含图片和题注" prop="paraContainPic">
                        <el-checkbox :true-label="1" :false-label="0" v-model="docSetForm.paraContainPic"></el-checkbox>
                    </el-form-item>
                    <el-form-item label="段落是否包含表格和题注" prop="paraContainTable">
                        <el-checkbox :true-label="1" :false-label="0" v-model="docSetForm.paraContainTable"></el-checkbox>
                    </el-form-item>
                    <el-form-item label="段落是否包含章节标题" prop="paraContainTitle">
                        <el-checkbox :true-label="1" :false-label="0" v-model="docSetForm.paraContainTitle"></el-checkbox>
                    </el-form-item>
                    <el-form-item label="高频词汇率阈值" prop="highFrequencyLevel">
                        <el-input-number v-model="docSetForm.highFrequencyLevel" :min="1" :max="10"></el-input-number>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <h4 class="formTitle">文档对比分析设置：</h4>
                    <el-form-item label="语义相似度" prop="similarity">
                        <el-radio-group v-model="docSetForm.similarity">
                            <el-radio :label="0">低</el-radio>
                            <el-radio :label="1">中</el-radio>
                            <el-radio :label="2">高</el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="语义相似背景色" prop="similarityColor">
                        <el-color-picker v-model="docSetForm.similarityColor"></el-color-picker>
                    </el-form-item>
                    <el-form-item label="文本差异背景色" prop="diffColor">
                        <el-color-picker v-model="docSetForm.diffColor"></el-color-picker>
                    </el-form-item>
                    <el-form-item label="差异处添加索引线" prop="addLine">
                        <el-checkbox :true-label="1" :false-label="0" v-model="docSetForm.addLine"></el-checkbox>
                    </el-form-item>
                    <el-form-item label="章节相似度" prop="chapterSimilarity">
                        <el-input style="width: 200px" v-model="docSetForm.chapterSimilarity">
                            <template slot="append">%</template>
                        </el-input>
                    </el-form-item>
                    <el-form-item label="段落相似度" prop="paraSimilarity">
                        <el-input style="width: 200px" v-model="docSetForm.paraSimilarity">
                            <template slot="append">%</template>
                        </el-input>
                    </el-form-item>
                </el-col>
            </el-row>

            <el-form-item style="float: right">
                <el-button type="primary" @click="submitDocSetForm">确 定</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>
<script>
import {
    getSetInfo,
    saveSetInfo
} from "@/api/compare/index"
export default {
    data() {
        return{
            docSetForm:{
                importance:1,
                statsByChapter:'',
                onlyTotal:'',
                containPunc:'',
                paraContainPic:'',
                paraContainTable:'',
                paraContainTitle:'',
                highFrequencyLevel:0,
                similarity:'',
                similarityColor:'',
                diffColor:'',
                addLine:false,
                chapterSimilarity:'',
                paraSimilarity:'',
            },
        }
    },
    mounted() {
        this.getInfo();
    },
    methods: {
        getInfo(){
            getSetInfo().then(res => {
                this.docSetForm = res.data[0];
            })
        },
        submitDocSetForm(){
            this.$refs["docSetFormRef"].validate(valid => {
                if (valid) {
                    saveSetInfo(this.docSetForm).then(res=>{
                        this.$message.success("保存成功");
                        this.getInfo();
                    })
                }
            })
        }
    }
}
</script>
<style scoped lang="scss">

</style>
